package com.example.dsplatform.Controller;

import com.example.dsplatform.Dao.Mapper.UserMapper;
import com.example.dsplatform.Service.ipml.AdminServiceIpml;
import com.example.dsplatform.Service.ipml.EmailServiceIpml;
import com.example.dsplatform.pojo.Entity.ResponseResult;
import com.example.dsplatform.Service.ipml.UserServiceImpl;
import com.example.dsplatform.pojo.Entity.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author wdx3004
 */

@RestController
@RequestMapping("/Student")
@ApiOperation(value = "学生功能接口")
public class StudentController {
    @Autowired
    UserServiceImpl userService;
    @Autowired
    UserMapper userMapper;
    @Autowired
    AdminServiceIpml admineServiceIpml;

    @PostMapping("/select")
    @ApiOperation(value = "实现按照名称查询功能")
    @PreAuthorize("hasAuthority('sys.select')")
    public ResponseResult select(@ApiParam("用户参数") @RequestBody User user) {
        return admineServiceIpml.selectByName(user);
    }



    @DeleteMapping("/signoff")
    @ApiOperation(value = "实现注销功能")
    public String deletebyID(Integer id) {
        userMapper.deleteById(id);
        return "delete success";
    }

/*    @PutMapping("/update")
    public String update(@RequestBody Student student) {
        userMapper.updateById(student);
        return "update success";
    }

    @PatchMapping("/student")
    public String updateType(@RequestBody Student student) {
        userMapper.updateById(student);
        return "update success";
    }*/

/*        @GetMapping("/login")
    public String select2login(Integer id, String name) {
        Map<String, Object> map = userService.select2login(id, name);
        if (map != null) {
            return "success";
        } else return "false";

    }*/
}


